package com.yuneec.droneservice.protocol.analysis;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.channels.FileChannel;

/**
 * Created by zd.zhang on 2017/10/24.
 */

public interface IAnalysis {
    byte PROTOCOL_HEADER_FLAG = 0x66;
    byte[] PROTOCOL_HEADER = new byte[]{PROTOCOL_HEADER_FLAG, PROTOCOL_HEADER_FLAG};

    void start(OutputStream mOutputStream);

    void stop();

    void read(InputStream is) throws IOException;

    void registMessageHandler(IMessageReceiver receiver);

    void unRegistMessageHandler(int id);

    int send(int id, byte[] data);

    int send(int id, byte[] data, int off, int len);

    void asyncSend(int id, byte[] data);

    void asyncSend(int id, byte[] data, int off, int len);

    void throwException(Throwable e, boolean clear);

    void setExceptionHandler(HandleException exceptionHandler);

    void selfWrite(byte b[], int off, int len, boolean flush);

}
